import axios from '@/utils/request'

export function getComments (articleId, offset) {
  return axios({
    method: 'get',
    url: '/v1_0/comments',
    params: {
      type: 'a',
      source: articleId,
      offset
    }
  })
}

// 获取某个评论的回复
export function getReplys (commentId, offset) {
  return axios({
    method: 'get',
    url: '/v1_0/comments',
    params: {
      type: 'c',
      source: commentId,
      offset
    }
  })
}

export function addComment (articleId, content) {
  return axios({
    method: 'post',
    url: '/v1_0/comments',
    data: {
      target: articleId,
      content
    }
  })
}

export function addReply (commentId, content, articleId) {
  return axios({
    method: 'post',
    url: '/v1_0/comments',
    data: {
      target: commentId,
      content,
      art_id: articleId
    }
  })
}
